package com.industrial.loweff.controller.lowcompany;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.core.util.NumberUtil;
import com.industrial.common.core.domain.R;
import com.industrial.common.core.web.controller.BaseController;
import com.industrial.common.core.web.domain.AjaxResult;
import com.industrial.common.core.web.page.TableDataInfo;
import com.industrial.common.security.utils.SecurityUtils;
import com.industrial.loweff.domain.JcQueryParam;
import com.industrial.loweff.domain.JcResVo;
import com.industrial.loweff.domain.LowEfficiencyBenefitEvaluation;
import com.industrial.loweff.service.ILowEffCompanyService;
import com.industrial.system.api.RemoteUserService;
import com.industrial.system.api.domain.SysUser;
import org.apache.commons.lang3.StringUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * <p>
 *     低效能企业管理
 * </p>
 * @author SangGuangCan
 */
@RestController
@RequestMapping("/low_eff_company_manage")
public class LowEffCompanyController extends BaseController {

    @Autowired
    private ILowEffCompanyService lowEffCompanyService;

    @Autowired
    private RemoteUserService remoteUserService;

    /**
     * 查询列表
     * @param params
     * @return
     */
    @GetMapping("/list")
    public TableDataInfo list(LowEfficiencyBenefitEvaluation params){

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();


        //如果不下数字，那就是因为这个接口是在大屏跳转来的
        if(!NumberUtil.isNumber(params.getCity())){
            R<List<String>> listR = remoteUserService.queryAreaCodeByAreaName(params.getCity());
            if(listR.getCode() == R.SUCCESS){
                List<String> data = listR.getData();
                if(data != null && !data.isEmpty()){
                    String s = data.get(0);
                    params.setCity(s);
                }
            }
        }

        if(sysUser.isAdmin()){
            params.setProvince("370000");
        }else{
            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
                if(StringUtils.isBlank(params.getCity())){
                    params.setCounty(sysUser.getDistrict());
                }else{
                    params.setVillage(params.getCity());
                }
                params.setCity(null);
            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
                if(StringUtils.isBlank(params.getCity())){
                    params.setCity(sysUser.getCity());
                }else{
                    params.setCounty(params.getCity());
                    params.setCity(null);
                }
            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
                if(StringUtils.isBlank(params.getCity())){
                    params.setProvince(sysUser.getProvince());
                }else{
                    params.setCity(params.getCity());
                }
            }
        }

        startPage();
        List<LowEfficiencyBenefitEvaluation> resultList = lowEffCompanyService.list(params);
        return getDataTable(resultList);
    }

    /**
     * 查询诊断信息
     * @return
     */
    @GetMapping("/queryZd")
    public AjaxResult queryZd(LowEfficiencyBenefitEvaluation params){
        Map<String,Object> result = lowEffCompanyService.queryZd(params);
        return AjaxResult.success(result);
    }

    /**
     * 查询单位用地税收监测
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/dwydssjcTable")
    public AjaxResult dwydssjcTable(JcQueryParam jcQueryParam){

        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));


        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }

        List<JcResVo> jcResVos = lowEffCompanyService.dwydssjcTable(jcQueryParam);
        return AjaxResult.success(jcResVos);
    }
    /**
     * 查询单位用地税收Charts
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/queryDwydssjcCharts")
    public AjaxResult queryDwydssjcCharts(JcQueryParam jcQueryParam){
        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }
        Map<String,Object> result = lowEffCompanyService.queryDwydssjcCharts(jcQueryParam);
        return AjaxResult.success(result);
    }


    /**
     * 查询单位能耗销售收入
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/dwnhxssrTable")
    public AjaxResult dwnhxssrTable(JcQueryParam jcQueryParam){

        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));


        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }


        List<JcResVo> jcResVos = lowEffCompanyService.dwnhxssrTable(jcQueryParam);
        return AjaxResult.success(jcResVos);
    }

    /**
     * 查询单位能耗销售收入Charts
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/queryDwnhxssrCharts")
    public AjaxResult queryDwnhxssrCharts(JcQueryParam jcQueryParam){
        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }

        Map<String,Object> result = lowEffCompanyService.queryDwnhxssrCharts(jcQueryParam);
        return AjaxResult.success(result);
    }


    /**
     * 查询单位污染排放销售收入
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/dwwrpfxssrTable")
    public AjaxResult dwwrpfxssrTable(JcQueryParam jcQueryParam){

        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));


        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else {
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }

        List<JcResVo> jcResVos = lowEffCompanyService.dwwrpfxssrTable(jcQueryParam);
        return AjaxResult.success(jcResVos);
    }

    /**
     * 查询单位污染排放销售收入Charts
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/queryDwwrpfxssrCharts")
    public AjaxResult queryDwwrpfxssrCharts(JcQueryParam jcQueryParam){
        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }

        Map<String,Object> result = lowEffCompanyService.queryDwwrpfxssrCharts(jcQueryParam);
        return AjaxResult.success(result);
    }


    /**
     * 查询研发经费投入
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/yfjftrTable")
    public AjaxResult yfjftrTable(JcQueryParam jcQueryParam){

        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));


        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }


        List<JcResVo> jcResVos = lowEffCompanyService.yfjftrTable(jcQueryParam);
        return AjaxResult.success(jcResVos);
    }

    /**
     * 查询研发经费投入Charts
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/queryYfjftrCharts")
    public AjaxResult queryYfjftrCharts(JcQueryParam jcQueryParam){
        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }

        Map<String,Object> result = lowEffCompanyService.queryYfjftrCharts(jcQueryParam);
        return AjaxResult.success(result);
    }


    /**
     * 查询全员劳动生产力
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/qyldsclTable")
    public AjaxResult qyldsclTable(JcQueryParam jcQueryParam){

        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));


        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }


        List<JcResVo> jcResVos = lowEffCompanyService.qyldsclTable(jcQueryParam);
        return AjaxResult.success(jcResVos);
    }


    /**
     * 查询全员劳动生产力Charts
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/queryQyldsclCharts")
    public AjaxResult queryQyldsclCharts(JcQueryParam jcQueryParam){
        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }


//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }

        Map<String,Object> result = lowEffCompanyService.queryQyldsclCharts(jcQueryParam);
        return AjaxResult.success(result);
    }


    /**
     * 查询单位用地销售
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/dwysxssrTable")
    public AjaxResult dwysxssrTable(JcQueryParam jcQueryParam){

        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));


        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            sysRoles.add("p_01_011");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }


        List<JcResVo> jcResVos = lowEffCompanyService.dwysxssrTable(jcQueryParam);
        return AjaxResult.success(jcResVos);
    }

    /**
     * 查询单位用地销售Charts
     * @param jcQueryParam
     * @return
     */
    @GetMapping("/queryDwysxssrCharts")
    public AjaxResult queryDwysxssrCharts(JcQueryParam jcQueryParam){
        LocalDate localDate = LocalDate.now();
        jcQueryParam.setYiYear(String.valueOf(localDate.getYear() - 1));
        jcQueryParam.setLiangYear(String.valueOf(localDate.getYear() - 2));
        jcQueryParam.setSanYear(String.valueOf(localDate.getYear() - 3));
        jcQueryParam.setSiYear(String.valueOf(localDate.getYear() - 4));
        jcQueryParam.setWuYear(String.valueOf(localDate.getYear() - 5));

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        if(sysUser.isAdmin()){
            sysRoles.add("p_01_011");
        }

        if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
            jcQueryParam.setCounty(sysUser.getDistrict());
            jcQueryParam.setCity(null);
        }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setCity(sysUser.getCity());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
            if(StringUtils.isBlank(jcQueryParam.getCity())){
                jcQueryParam.setProvince(sysUser.getProvince());
            }else{
                if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
                    jcQueryParam.setProvince(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
                    jcQueryParam.setCity(jcQueryParam.getCity());
                }else {
                    jcQueryParam.setCounty(jcQueryParam.getCity());
                    jcQueryParam.setCity(null);
                }
            }
        }

//        if(sysUser.isAdmin()){
//            jcQueryParam.setProvince("370000");
//        }else{
//            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
//                jcQueryParam.setCounty(sysUser.getDistrict());
//                jcQueryParam.setCity(null);
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setCity(sysUser.getCity());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
//                if(StringUtils.isBlank(jcQueryParam.getCity())){
//                    jcQueryParam.setProvince(sysUser.getProvince());
//                }else{
//                    if(StringUtils.endsWith(jcQueryParam.getCity(),"0000")){
//                        jcQueryParam.setProvince(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }else if(StringUtils.endsWith(jcQueryParam.getCity(),"00")){
//                        jcQueryParam.setCity(jcQueryParam.getCity());
//                    }else {
//                        jcQueryParam.setCounty(jcQueryParam.getCity());
//                        jcQueryParam.setCity(null);
//                    }
//                }
//            }
//        }
        Map<String,Object> result = lowEffCompanyService.queryDwysxssrCharts(jcQueryParam);
        return AjaxResult.success(result);
    }



    /**
     * 查询低效能企业
     * @param params
     * @return
     */
    @GetMapping("/queryLowerCompanyInfoByCd")
    public TableDataInfo queryLowerCompanyInfoByCd(LowEfficiencyBenefitEvaluation params){

        Set<String> sysRoles = SecurityUtils.getLoginUser().getRoles();
        SysUser sysUser = SecurityUtils.getLoginUser().getSysUser();

        //如果不下数字，那就是因为这个接口是在大屏跳转来的
        if(!NumberUtil.isNumber(params.getCity())){
            R<List<String>> listR = remoteUserService.queryAreaCodeByAreaName(params.getCity());
            if(listR.getCode() == R.SUCCESS){
                List<String> data = listR.getData();
                if(data != null && !data.isEmpty()){
                    String s = data.get(0);
                    params.setCity(s);
                }
            }
        }

        if(sysUser.isAdmin()){
            params.setProvince("370000");
        }else{
            if(ArrayUtil.contains(sysRoles.toArray(),"x_01_011")){
                if(StringUtils.isBlank(params.getCity())){
                    params.setCounty(sysUser.getDistrict());
                }else{
                    params.setVillage(params.getCity());
                }
                params.setCity(null);
            }else if(ArrayUtil.contains(sysRoles.toArray(),"s_01_011")){
                if(StringUtils.isBlank(params.getCity())){
                    params.setCity(sysUser.getCity());
                }else{
                    params.setCounty(params.getCity());
                    params.setCity(null);
                }
            }else if(ArrayUtil.contains(sysRoles.toArray(),"p_01_011")){
                if(StringUtils.isBlank(params.getCity())){
                    params.setProvince(sysUser.getProvince());
                }else{
                    params.setCity(params.getCity());
                }
            }
        }

        startPage();
        List<JcResVo> jcResVos = lowEffCompanyService.queryLowerCompanyInfoByCd(params);
        return getDataTable(jcResVos);
    }
}
